
import { ModalForm, ProFormDigit, ProFormRadio } from '@ant-design/pro-components';
import { Form } from 'antd';

export default function AutoCraftDailog({children, onFinish, showSalvageCardOption}) {
  const [form] = Form.useForm();
  return (
    <ModalForm
      title="新建表单"
      trigger={children}
      form={form}
      autoFocusFirstInput
      modalProps={{
        destroyOnClose: true,
      }}
      submitTimeout={2000}
      onFinish={values => {
        onFinish(values)
        return true
      }}
    >
      <ProFormDigit
        name="start_idx"
        label="start_idx"
        initialValue={0}
      />

      <ProFormDigit
        name="limit"
        label="limit"
        initialValue={0}
      />
      <ProFormRadio.Group
        name="reset_keyboard"
        label="重置按键"
        initialValue={0}
        options={[
          {label: '是', value: 1},
          {label: '否', value: 0},
        ]}
      />
      <ProFormRadio.Group
        name="get_emails"
        label="收邮件"
        initialValue={0}
        options={[
          {label: '是', value: 1},
          {label: '否', value: 0},
        ]}
      />
      <ProFormRadio.Group
        name="profession_type"
        label="专业"
        initialValue={0}
        options={[
          {label: '全部', value: 0},
          {label: '仅锻造', value: 1},
          {label: '仅附魔', value: 2},
        ]}
      />
      {showSalvageCardOption && (
        <ProFormRadio.Group
          name="salvage_card"
          label="同时拆卡片"
          initialValue={0}
          options={[
            {label: '是', value: 1},
            {label: '否', value: 0},
          ]}
        />
      )}
    </ModalForm>
  )
}